package cn.iocoder.yudao.module.kt.dal.mysql.studyfile;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.kt.dal.dataobject.studyfile.StudyFileDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.kt.controller.admin.studyfile.vo.*;

/**
 * 学习资料 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface StudyFileMapper extends BaseMapperX<StudyFileDO> {

    default PageResult<StudyFileDO> selectPage(StudyFilePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudyFileDO>()
                .likeIfPresent(StudyFileDO::getName, reqVO.getName())
                .eqIfPresent(StudyFileDO::getType, reqVO.getType())
                .eqIfPresent(StudyFileDO::getNum, reqVO.getNum())
                .betweenIfPresent(StudyFileDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(StudyFileDO::getPicId, reqVO.getPicId())
                .eqIfPresent(StudyFileDO::getFileId, reqVO.getFileId())
                .orderByDesc(StudyFileDO::getId));
    }

}